#include<reg51.h>

void delay(unsigned char a)
{
    unsigned int i;
    unsigned int j;
    while(a--)
    {
        for(i = 0; i< 2;i++)
        {
            for(j = 0; j < 255; j++);
        }
    }
}

void main()
{
    unsigned char index, LED;
    SCON = 0x00;//方式0
    while(1)
    {
        LED = 0x7f;
        for(index = 0; index < 8; index++)
        {
            SBUF = LED;//数据
            while(!TI);//发送中断
            LED = ((LED>>1)|0x80); //& ^ ~ |
            TI = 0;//软件清0
            delay(50);
        }
    }
}